The OPNQRYF command has made us change the way we design some of our applications. Most of our query situations are standardized report programs with the selection criteria being the only variable. This means the query has to run in batch after some sort of interactive application has formatted the request. Since we did not want to create a CL program for each request, we tried creating the job stream in a source file and using the STRDBRDR command to start the batch job. This worked, but it didn't give the interactive user much control over the batch job via the DSPSBMJOB command. By using the following command, we can now use SBMJOB with EXCSRCJOB as the RQSDTA and it works as if the user requested a compiled program. In development, is very easy to construct a OPNQRYF job stream in QCLSRC and run it using option 6 of the programmers menu with EXCSRCJOB QCLSRC.library member on the command line. It also gets around the 256 character restriction of RQSDTA. Bob Hughes, Pandols (805)725-3755 Command source-------------------------------------------------------- CMD PROMPT('EXeCute SouRCe member JOB') PARM KWD(FILE) TYPE(QUAL1) MIN(1) PROMPT('Source + file') PARM KWD(MEMBER) TYPE(*NAME) LEN(10) MIN(1) + PROMPT('Source member name') QUAL1: QUAL TYPE(*NAME) LEN(10) MIN(1) QUAL TYPE(*CHAR) LEN(10) DFT(*LIBL) + PROMPT('Library') Command processing source--------------------------------------------- PGM PARM(&FILE &MBR) DCLF FILE(QCLSRC.QGPL) DCL VAR(&FILE) TYPE(*CHAR) LEN(20) DCL VAR(&FNAM) TYPE(*CHAR) LEN(10) DCL VAR(&FLIB) TYPE(*CHAR) LEN(10) DCL VAR(&MBR) TYPE(*CHAR) LEN(10) DCL VAR(&MSGID ) TYPE(*CHAR) LEN( 7) DCL VAR(&MSGF ) TYPE(*CHAR) LEN(10) DCL VAR(&MSGDTA) TYPE(*CHAR) LEN(100) DCL VAR(&MSGFLIB) TYPE(*CHAR) LEN(10) MONMSG MSGID(CPF0000) EXEC(GOTO CMDLBL(ERROR)) CHGVAR VAR(&FNAM) VALUE(%SST(&FILE 1 10)) CHGVAR VAR(&FLIB) VALUE(%SST(&FILE 11 10)) OVRDBF FILE(QCLSRC) TOFILE(&FNAM.&FLIB) MBR(&MBR) LOOP: RCVF MONMSG MSGID(CPF0864) EXEC(GOTO CMDLBL(EXIT)) SNDPGMMSG MSG(&SRCDTA) TOPGMQ(*EXT) MSGTYPE(*RQS) GOTO CMDLBL(LOOP) EXIT: CHGJOB LOGCLPGM(*YES) TFRCTL PGM(QCL.QSYS) /* Error handling routine to receive any *ESCAPE messages and resend + them to the user and then end with a CPF9898 *ESCAPE message */ ERROR: RCVMSG MSGDTA(&MSGDTA) MSGID(&MSGID) MSGF(&MSGF) + MSGFLIB(&MSGFLIB) IF COND(&MSGID *EQ ' ') THEN(GOTO CMDLBL(FAIL)) SNDPGMMSG MSGID(&MSGID) MSGF(&MSGF.&MSGFLIB) + MSGDTA(&MSGDTA) MSGTYPE(*INFO) GOTO CMDLBL(ERROR) FAIL: SNDPGMMSG MSGID(CPF9898) MSGF(QCPFMSG.QSYS) MSGDTA('The + SBMSRCJOB command failed to complete, + review prior messages') MSGTYPE(*ESCAPE) ENDPGM